//
// Copyright (c) 2011, Peter Lane
// Licensed under the Academic Free License version 3.0

package fan.swtChartWrapper;

import fan.fwt.*;
import fan.gfx.Color;
import fan.sys.*;
import org.eclipse.swtchart.IGrid;

public class GridPeer {
  private IGrid _grid = null;

  public static GridPeer make (fan.swtChartWrapper.Grid self) throws Exception {
    return new GridPeer ();
  }

  public void setIGrid (IGrid igrid) {
    _grid = igrid;
    _grid.setForeground (Fwt.get().color(_foreground));
    _grid.setStyle (Utility.toSwt (_linestyle));
  }

  private Color _foreground = Color.gray.lighter();
  public Color foreground (fan.swtChartWrapper.Legend self) { return _foreground; }
  public void foreground (fan.swtChartWrapper.Legend self, Color v) {
    _foreground = v;
    if (_grid != null) _grid.setForeground (Fwt.get().color(_foreground));
  }

  private LineStyle _linestyle = LineStyle.dot;
  public LineStyle _linestyle (fan.swtChartWrapper.Grid self) { return _linestyle; }
  public void linestyle (fan.swtChartWrapper.Grid self, LineStyle v) {
    _linestyle = v;
    if (_grid != null) _grid.setStyle (Utility.toSwt (_linestyle));
  }
}

